﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package net.wooga.pets.controllers {
    import flash.display.*;
    import net.wooga.pets.events.*;
    import net.wooga.pets.models.*;
    import net.wooga.pets.constants.*;
    import org.robotlegs.mvcs.*;
    import net.wooga.pets.utils.*;

    public class TopFloorChangedCommand extends Command {

		[Inject]
        public var roomSlotsModel:RoomSlotsModel;

        override public function execute():void{
            var _local1:Number = (GameConstants.ROOM_WIDTH * (RoomSlotsModel.ELEVATOR_BEFORE_COLOUMN - 1));
            var _local2:Number = ((-(GameConstants.ROOM_HEIGHT) * (this.roomSlotsModel.topFloor + 1)) - GameConstants.BASEMENT_HEIGHT);
            var _local3:Object = new Object();
            _local3.id = "elevator_shaft";
            _local3.x = _local1;
            _local3.y = _local2;
            _local3.linkageId = GameConstants.ELAVATOR_SHAFT;
            dispatch(new CreationEvent(CreationEvent.CREATE_ELEVATOR_SHAFT, _local3));
            var _local4:MovieClip = AssetsLibrary.getMovieClip(GameConstants.ROOF_BROWN_02);
            _local3 = new Object();
            _local3.id = "elevator_roof";
            _local3.x = _local1;
            _local3.y = (_local2 - _local4.height);
            _local3.linkageId = GameConstants.ROOF_BROWN_02;
            if (this.roomSlotsModel.topFloor == 0){
                dispatch(new CreationEvent(CreationEvent.CREATE_ELEVATOR_ROOF, _local3));
            } else {
                if (this.roomSlotsModel.topFloor > 0){
                    dispatch(new UpdateDisplayEvent(UpdateDisplayEvent.UPDATE_ROOF_DISPLAY, _local3.x, _local3.y, "elevator_roof"));
                };
            };
        }

    }
}//package net.wooga.pets.controllers 
